
// JScript 文件
$(function(){
$("#pl_bt").click(function(event){
var name = $("#lxphone").val();
var content = $("#line_con").val();
var jieshouren = $("#dx_pl").text();


if(name.length == 0)
{
    $("#lianxidianhua").html("请输入联系电话！");
    return false;
}
else
{
        var phone=/^1(3|5|4|8)\d{9}$/;
	    var tel=/^(([0-9]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{1,}))?$/;
	    var newtel=/^(400)-(\d{3})-(\d{4})$/;
	    if(tel.test(name.replace(/(\s*$)/g, "")) || phone.test(name.replace(/(\s*$)/g, "")) || newtel.test(name.replace(/(\s*$)/g, "")))
        {
            $("#lianxidianhua").html("");
        }
        else
        {
            $("#lianxidianhua").html("联系电话格式不正确！");
            return false;
        }
}



if(content.length == 0)
{
    $("#plcontent").html("请输入评论内容！");
    return false;
}
else
{
    $("#plcontent").html("");

}


htmlobj=$.ajax({url:"../js/PingLunAjax.aspx?type=1&Content="+ content + "<br />联系电话：" +name +"&jieshouren="+jieshouren,async:false});

var return_num=htmlobj.responseText;


if(return_num == 1)
{
    var str = "留言失败，请登陆！";
}
if(return_num == 2)
{
     var str = "留言成功！";
}
if(return_num == 3)
{
    var str = "留言失败，请联系管理员！";
}
$("#body").css("opacity","0.3");
$("#demo").css("opacity","0.3");
$("#p1").html(str);
var wid = $(window).width();
var hei = $(window).height();
var lef = (wid - 300)/2+"px";
var heii = (hei - 60)/2+"px";
$("#dialog").css({
"z-index":"5",
"position":"absolute",
"display":"block",
"width":"300px",
"height":"60px",
"left":lef,
"top":heii,
"background":"white",
"color":"black",
"border":" solid #525252"
});
});



$("#close").click(function(event)
{
    $("#dialog").slideUp("1000");
    $("#body").css("opacity","1.0");
    $("#demo").css("opacity","1.0");
});
});
